import { request3,request4 } from './request'

export function getShopInfo(args) {

  const config = {
    url: '/restaurant/' + args.id,
    params: {
      latitude: args.latitude,
      longitude: args.longitude,
      extras: []
    }
  }
  if (args.extrasParams) {
    for (const value of args.extrasParams) {
      config.params.extras.push(value)
    }
  }
  return request3(config)
}

export function getShopMenu(restaurant_id) {
  return request3({
    url: '/v2/menu',
    params: {
      restaurant_id
    }
  })
}

export function getScores(restaurants_id) {
  return request4({
    url: `${restaurants_id}/ratings/scores`
  })
}

export function getTags(restaurants_id) {
  return request4({
    url: `${restaurants_id}/ratings/tags`
  })
}

export function getRating(restaurants_id,has_content,offset,limit,tag_name='') {
  return request4({
    url: `${restaurants_id}/ratings`,
    params: {
      has_content,
      offset,
      limit,
      tag_name
    }
  })
}

export class Introduction {
  constructor(args) {
    this.img = `http://elm.cangdu.org/img/${args.img}`,
      this.name = args.name,
      this.tips = args.tips,
      this.notice = args.notice
      this.activities = args.activities
  }
}

export class shopDetail {
  constructor(args) {
    this.supports = args.supports
    this.name = args.name
    this.activities = args.activities
    this.status = args.status
    this.address = args.address
    this.openingHuors = args.openingHuors
  }
}

